package com.txby.hisJob.component.web;

import java.util.Arrays;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.txby.hisJob.component.service.HisBaseService;
import com.txby.hisJob.component.util.DatabaseContextHolder;
import com.txby.platformCore.component.service.CommonController;
import com.txby.platformCore.entity.TxbySysApiUser;

@Controller
public class TemplateController extends CommonController {
	@Resource
	private HisBaseService   HisBaseService;
   
	/**
	 * @return
	 * @throws Exception 
	 */
	@RequestMapping("/hello")
	public String hello(Map<String,Object> map,Model model) {
		//返回的是ModelAndView对象;
//		ModelAndView mv = new ModelAndView("hello");
//		return mv;
		map.put("name","jiaojing");
		model.addAttribute("message","message2222");
		map.put("list",Arrays.asList("s1","s2"));
		
		TxbySysApiUser gau=new TxbySysApiUser();
		  gau=new TxbySysApiUser();
			gau.setUserName("20170829mybaits张jiaojing");
//			gau.setId("fddddddddddddd");
			gau.setPassWord("123456");
//		mBaseDao.saveObject(gau);
		HisBaseService.excuteSaveObject(gau);
		
		/*	gau.setUserName("20170829mybaits张jiaojing");
//			gau.setId("fddddddddddddd");
			gau.setPassWord("123456");
			mBaseDao.saveObject(gau);
			gau.setUserName("hibernate张jiaojing");
			gau.setPassWord("123456");*/
		  /* for(int i=0;i<1;i++){
			   gau=new TxbySysApiUser();
				gau.setUserName("20170829mybaits张jiaojing");
//				gau.setId("fddddddddddddd");
				gau.setPassWord("123456");
//				DatabaseContextHolder.setDsName("dsTxbyHis");
				
//				DatabaseContextHolder.setDsName("dsTxby");
//				mBaseDao.saveObject(gau);
//				gau.setUserName("hibernate张jiaojing");
//				gau.setPassWord("123456");
			}*/
			System.out.println("OKKKK");
		return "hello";
	}
	
	@RequestMapping("/helloFtl")
	public String helloFtl(Map<String,Object> map,Model model){
		map.put("name","jiaojing");
		model.addAttribute("message","message");
		map.put("list",Arrays.asList("s1","s2"));
		return "helloFtl";
	}
   
}